home *** CD-ROM | disk | FTP | other *** search
- # Program: xf
- # Description: handle dial widgets
- #
- # $Header: Dial[2.3] Wed Mar 10 11:57:20 1993 garfield@garfield frozen $
-
- global xfDefaultConf
- set xfDefaultConf(dial) 4
-
- ##########
- # Procedure: XFAdd.Dial
- # Description: add a dial
- # Arguments: xfW - the widget
- # xfName - a optional name
- # xfType - add or config
- # Returns: none
- # Sideeffects: none
- ##########
- proc XFAdd.Dial {xfW xfName xfType} {
- global xfStatus
-
- XFEditSetStatus "Inserting Dial..."
- set xfName [XFMiscGetUniqueName $xfName dial]
- if {"$xfStatus(path)" == "."} {
- if {"$xfType" == "add"} {
- if {[catch "dial .$xfName" xfResult]} {
- XFProcError "$xfResult"
- XFEditSetStatus "Inserting Dial...aborted"
- return
- }
- } {
- if {[catch "dial .$xfName" xfResult]} {
- XFProcError "$xfResult"
- XFEditSetStatus "Inserting Dial...aborted"
- return
- }
- }
-
- XFMiscPositionWidget .$xfName
- XFMiscBindWidgetTree .$xfName
- } {
- if {"$xfType" == "add"} {
- if {[catch "dial $xfStatus(path).$xfName" xfResult]} {
- XFProcError "$xfResult"
- XFEditSetStatus "Inserting Dial...aborted"
- return
- }
- } {
- if {[catch "dial $xfStatus(path).$xfName" xfResult]} {
- XFProcError "$xfResult"
- XFEditSetStatus "Inserting Dial...aborted"
- return
- }
- }
-
- XFMiscPositionWidget $xfStatus(path).$xfName
- XFMiscBindWidgetTree $xfStatus(path).$xfName
- }
-
- incr xfStatus(elementCounter)
- XFEditSetPath $xfStatus(path)
- XFEditSetStatus "Inserting Dial...done"
- }
-
- ##########
- # Procedure: XFConfig.Dial4
- # Description: configure a dial
- # Arguments: xfW - the widget
- # xfType - config type (add or config)
- # xfClass - the class we configure
- # xfLeader - the leading window
- # Returns: none
- # Sideeffects: none
- ##########
- proc XFConfig.Dial4 {xfW xfType xfClass {xfLeader ""}} {
- global xfStatus
-
- if {"$xfType" == "add"} {
- set xfName dial$xfStatus(elementCounter)
- } {
- set xfName [XFMiscPathName $xfW]
- }
- XFEditSetStatus "Calling parameter setting for Dial..."
-
- # build widget structure
- XFTmpltToplevel .xf${xfClass}Config4 400x640 \
- "Dial parameters:[XFMiscPathTail $xfW]" $xfLeader
-
- XFElementInit $xfW .xf${xfClass}Config4 $xfType $xfClass \
- XFDialSetDial4 parameters $xfName 4
- XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass bg \
- background Background "Background" XFDialSetDial4
- XFElementScaleDouble $xfW .xf${xfClass}Config4 $xfType \
- $xfClass degree "Degree" "Begin" "End" 360 360
- XFElementText $xfW .xf${xfClass}Config4 $xfType $xfClass interval \
- interval Interval "Interval" XFDialSetDial4
- XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass majortickcolor \
- majortickcolor Foreground "Major tick color" XFDialSetDial4
- XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass needlecolor \
- needlecolor Foreground "Needle color" XFDialSetDial4
- XFElementScale $xfW .xf${xfClass}Config4 $xfType $xfClass radius \
- radius Radius "Radius" "pixels" 400 XFDialSetDial4
- XFElementBoolean $xfW .xf${xfClass}Config4 $xfType $xfClass showvalue \
- "Show value" XFDialSetDial4
- XFElementText $xfW .xf${xfClass}Config4 $xfType $xfClass title \
- title Title "Text" XFDialSetDial4
- XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass textcolor \
- textcolor Foreground "Text color" XFDialSetDial4
- XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass tickcolor \
- tickcolor Foreground "Tick color" XFDialSetDial4
- XFElementScaleDouble $xfW .xf${xfClass}Config4 $xfType \
- $xfClass ticks "Ticks" "Total" "Major" 500 250
- XFElementScaleDouble $xfW .xf${xfClass}Config4 $xfType \
- $xfClass value "Value" "Min" "Max" 2000 2000
- XFElementCommand $xfW .xf${xfClass}Config4 $xfType
-
- .xf${xfClass}Config4.params1.params2.degree.degree1.degree1 set \
- [lindex [$xfW config -begindegree] 4]
- .xf${xfClass}Config4.params1.params2.degree.degree2.degree2 set \
- [lindex [$xfW config -enddegree] 4]
- .xf${xfClass}Config4.params1.params2.ticks.ticks1.ticks1 set \
- [lindex [$xfW config -numticks] 4]
- .xf${xfClass}Config4.params1.params2.ticks.ticks2.ticks2 set \
- [lindex [$xfW config -majorticks] 4]
- .xf${xfClass}Config4.params1.params2.value.value1.value1 set \
- [lindex [$xfW config -minvalue] 4]
- .xf${xfClass}Config4.params1.params2.value.value2.value2 set \
- [lindex [$xfW config -maxvalue] 4]
-
- XFMiscSetResource \
- .xf${xfClass}Config4.params1.params2.degree.degree1.degree1 \
- command "XFDialSetDial4 $xfW 0 $xfClass"
- XFMiscSetResource \
- .xf${xfClass}Config4.params1.params2.degree.degree2.degree2 \
- command "XFDialSetDial4 $xfW 0 $xfClass"
- XFMiscSetResource \
- .xf${xfClass}Config4.params1.params2.ticks.ticks1.ticks1 \
- command "XFDialSetDial4 $xfW 0 $xfClass"
- XFMiscSetResource \
- .xf${xfClass}Config4.params1.params2.ticks.ticks2.ticks2 \
- command "XFDialSetDial4 $xfW 0 $xfClass"
- XFMiscSetResource \
- .xf${xfClass}Config4.params1.params2.value.value1.value1 \
- command "XFDialSetDial4 $xfW 0 $xfClass"
- XFMiscSetResource \
- .xf${xfClass}Config4.params1.params2.value.value2.value2 \
- command "XFDialSetDial4 $xfW 0 $xfClass"
-
- # save current parameter
- XFElementSave $xfW $xfClass {background begindegree enddegree interval majortickcolor needlecolor radius showvalue textcolor tickcolor title maxvalue minvalue numticks majorticks command}
-
- # packing
- pack append .xf${xfClass}Config4.params1 \
- .xf${xfClass}Config4.params1.params2 {left fill expand}
- pack append .xf${xfClass}Config4 \
- .xf${xfClass}Config4.pathname {top fill frame center} \
- .xf${xfClass}Config4.leave {bottom fill} \
- .xf${xfClass}Config4.additional {bottom fill} \
- .xf${xfClass}Config4.params1 {top fill expand}
-
- XFBindFormConnect .xf${xfClass}Config4.params1.params2 \
- "XFDialSetDial4 $xfW 0 $xfClass"
-
- XFEditSetStatus "Calling parameter setting for Dial...done"
- }
-
- ##########
- # Procedure: XFSaveSpecial.Dial
- # Description: save dial
- # Arguments: xfW - the widget
- # Returns: none
- # Sideeffects: none
- ##########
- proc XFSaveSpecial.Dial {xfW} {
-
- return "\n $xfW set [$xfW get]"
- }
-
- ##########
- # Procedure: XFDialSetDial4
- # Description: set dial parameters
- # Arguments: xfW - the widget
- # xfType - the type of setting (1 = set always, 0 = set
- # only if permanent apply is on)
- # xfClass - the class we configure
- # xfParam1 - ignored parameter
- # Returns: none
- # Sideeffects: none
- ##########
- proc XFDialSetDial4 {xfW xfType xfClass {xfParam1 ""}} {
- global xfConf
- global xfMisc
-
- if {$xfType == 0 && !$xfConf(applyParameters)} {
- return
- }
- if {"[info commands $xfW]" == ""} {
- return
- }
- XFMiscSetSymbolicName $xfW \
- [.xf${xfClass}Config4.params1.params2.symname.symname get]
-
- XFMiscSetResource $xfW background \
- [.xf${xfClass}Config4.params1.params2.bg.bg get]
- XFMiscSetResource $xfW begindegree \
- [.xf${xfClass}Config4.params1.params2.degree.degree1.degree1 get]
- XFMiscSetResource $xfW enddegree \
- [.xf${xfClass}Config4.params1.params2.degree.degree2.degree2 get]
- XFMiscSetResource $xfW command \
- [XFMiscGetText .xf${xfClass}Config4.params1.params2.command.command.command]
- if {"[.xf${xfClass}Config4.params1.params2.interval.interval get]" != ""} {
- XFMiscSetResource $xfW interval \
- [.xf${xfClass}Config4.params1.params2.interval.interval get]
- } {
- XFMiscSetResource $xfW interval 0
- }
- XFMiscSetResource $xfW maxvalue \
- [.xf${xfClass}Config4.params1.params2.value.value2.value2 get]
- XFMiscSetResource $xfW minvalue \
- [.xf${xfClass}Config4.params1.params2.value.value1.value1 get]
- if {"[.xf${xfClass}Config4.params1.params2.majortickcolor.majortickcolor get]" != ""} {
- XFMiscSetResource $xfW majortickcolor \
- [.xf${xfClass}Config4.params1.params2.majortickcolor.majortickcolor get]
- }
- XFMiscSetResource $xfW majorticks \
- [.xf${xfClass}Config4.params1.params2.ticks.ticks2.ticks2 get]
- if {"[.xf${xfClass}Config4.params1.params2.needlecolor.needlecolor get]" != ""} {
- XFMiscSetResource $xfW needlecolor \
- [.xf${xfClass}Config4.params1.params2.needlecolor.needlecolor get]
- }
- XFMiscSetResource $xfW numticks \
- [.xf${xfClass}Config4.params1.params2.ticks.ticks1.ticks1 get]
- XFMiscSetResource $xfW radius \
- [.xf${xfClass}Config4.params1.params2.radius.radius get]
- XFMiscSetResource $xfW showvalue $xfMisc(showvalue)
- if {"[.xf${xfClass}Config4.params1.params2.textcolor.textcolor get]" != ""} {
- XFMiscSetResource $xfW textcolor \
- [.xf${xfClass}Config4.params1.params2.textcolor.textcolor get]
- }
- if {"[.xf${xfClass}Config4.params1.params2.tickcolor.tickcolor get]" != ""} {
- XFMiscSetResource $xfW tickcolor \
- [.xf${xfClass}Config4.params1.params2.tickcolor.tickcolor get]
- }
- XFMiscSetResource $xfW title \
- [.xf${xfClass}Config4.params1.params2.title.title get]
- }
-
- # eof
-
-